import "package:flutter_easyloading/flutter_easyloading.dart";
import "package:ttlock_flutter/ttlock.dart";
import "dart:async";

class DeviceUtil {
  Future<bool> bluetoothOperation() {
    // 使用Completer来正确处理异步回调
    final completer = Completer<bool>();
    
    TTLock.getBluetoothState((state) {
      print("回调：$state");
      if (state == TTBluetoothState.turnOn) {
        completer.complete(true);
      } else {
        completer.complete(false);
      }
    });
    
    return completer.future;
  }
  
}

